package com.mygdx.game.Stage;


import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.InputListener;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.Image;
import com.mygdx.game.Scenes.ActiveCharacter;
import com.mygdx.game.Screens.PlayScreen;

public class GeneralStage extends Stage {
    public ActiveCharacter activeCharacter;
    Texture texture;
    TextureRegion startRegion;
    Image startImage;
    TextureRegion newGameRegion;
    Image newGameBtn;
    private String background;


    public GeneralStage(String background) {
        super();
        this.background = background;
        init();
    }

    private void init() {
        texture = new Texture(Gdx.files.internal(background)); //"GroupProject/image/story.png"
      //  startRegion = new TextureRegion(texture, 0, 0, 1000, 1080);
        startImage = new Image(texture);
            startImage.setSize(200, 200);
        newGameRegion = new TextureRegion(texture, 200, 930, 1000, 120);
        newGameBtn = new Image(newGameRegion);
        newGameBtn.setSize(1080, 120);
        newGameBtn.setPosition(600, 0);
        activeCharacter = new ActiveCharacter("Character/Protagonist",910,495);
       activeCharacter.move = true;
        this.addActor(startImage);
//        this.addActor(newGameBtn);
        this.addActor(activeCharacter);


        newGameBtn.addListener(new InputListener() {
            @Override
            public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
                System.out.println("返回");
//                PlayScreen.flag = 0;
                return true;
            }
        });
    }
}
